package com.bto.solar.work.controller;

import com.bto.solar.work.common.R;
import com.bto.solar.work.qiniu.QiNiuService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 王小波
 * @description:
 * @date 2023/8/29 8:18
 */

@RestController
@RequestMapping("/file")
public class ImageController {
    @Autowired
    private QiNiuService qiNiuService;
    @ApiModelProperty("获取七牛云上图片token")
    @GetMapping("get-qiniu-upload-token")
    public R getQiNiuUploadToken(String orderId , String fileType){
        return R.ok(qiNiuService.getUploadToken(orderId , fileType));
    }

//    @ApiModelProperty("获取七牛云上图片token-banner")
//    @GetMapping("get-qiniu-upload-token/banner")
//    public R getQiNiuUploadTokenBanner(){
//        return R.ok(qiNiuService.getQiNiuUploadTokenBanner());
//    }


    @ApiModelProperty("获取七牛云上图片token-record")
    @GetMapping("get-qiniu-upload-token/{path}")
    public R getQiNiuUploadTokenRecord(@PathVariable String path){
        return R.ok(qiNiuService.getQiNiuUploadTokenPath(path));
    }
}
